package com.xywang.dao.bill;

import com.xywang.pojo.Bill;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class BillDaoImpl implements BillDao{
    private SqlSessionTemplate sqlSessionTemplate;
    @Autowired
    public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    @Override
    public List<Bill> getBillList(String queryProductName,String queryProviderId ,String queryIsPayment, int currentPageNo, int pageSize) {
        return sqlSessionTemplate.getMapper(BillDao.class).getBillList(queryProductName,queryProviderId ,queryIsPayment,currentPageNo,pageSize);
    }

    @Override
    public int getBillCount(Bill bill) {
        return sqlSessionTemplate.getMapper(BillDao.class).getBillCount(bill);
    }

    @Override
    public int addBill(Bill bill) {
        return sqlSessionTemplate.getMapper(BillDao.class).addBill(bill);
    }

    @Override
    public int deleteBill(int delId) {
        return sqlSessionTemplate.getMapper(BillDao.class).deleteBill(delId);
    }

    @Override
    public Bill getBillById(int delId) {
        return sqlSessionTemplate.getMapper(BillDao.class).getBillById(delId);
    }

    @Override
    public int modify(Bill bill) {
        return sqlSessionTemplate.getMapper(BillDao.class).modify(bill);
    }

    @Override
    public int getBillCountByProviderId(int providerId) {
        return sqlSessionTemplate.getMapper(BillDao.class).getBillCountByProviderId(providerId);
    }
}
